home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / CBGRX103.ZIP / contrib / libgrx / src / custpoly.c < prev    next >
Text File  |  1993-12-06  |  3KB  |  96 lines

  1. /**
  2.  ** CUSTLINE.H
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #include "grx.h"
  25. #include "libgrx.h"
  26. #include "thicklne.h"
  27.  
  28. void _GrDoCustomCorner(int x,int y,void *arg)
  29. {
  30.     GrCustomLineData *dta = (GrCustomLineData *)arg;
  31.  
  32.     if((dta->opt.lno_width >= 3) &&
  33.        !dta->is_XOR_color &&
  34.        (dta->total_pattlen == 0)) _GrScanEllipse(x,y,
  35.         dta->opt.lno_width >> 1,
  36.         dta->opt.lno_width >> 1,
  37.         TRUE,
  38.         FALSE,
  39.         dta->pixelproc,
  40.         dta->borderproc,
  41.         dta->scanfillproc,
  42.         dta->fillarg
  43.     );
  44. }
  45.  
  46. void GrCustomPolyLine(int numpts,int points[][2],GrLineOption *o)
  47. {
  48.     GrCustomLineData args;
  49.  
  50.     _GrBuildCustomLineData(o,&args);
  51.     _GrSetupSolidDraw(&o->lno_color,&args);
  52.     _GrDrawPolygon(numpts,points,
  53.         FALSE,
  54.         TRUE,
  55.         _GrDoCustomCorner,
  56.         _GrDoCustomSegment,
  57.         &args
  58.     );
  59. }
  60.  
  61. void GrCustomPolygon(int numpts,int points[][2],GrLineOption *o)
  62. {
  63.     GrCustomLineData args;
  64.  
  65.     _GrBuildCustomLineData(o,&args);
  66.     _GrSetupSolidDraw(&o->lno_color,&args);
  67.     _GrDrawPolygon(numpts,points,
  68.         TRUE,
  69.         TRUE,
  70.         _GrDoCustomCorner,
  71.         _GrDoCustomSegment,
  72.         &args
  73.     );
  74. }
  75.  
  76. void GrCustomBox(int x1,int y1,int x2,int y2,GrLineOption *o)
  77. {
  78.     GrCustomLineData args;
  79.     int points[4][2];
  80.  
  81.     points[0][0] = x1; points[0][1] = y1;
  82.     points[1][0] = x1; points[1][1] = y2;
  83.     points[2][0] = x2; points[2][1] = y2;
  84.     points[3][0] = x2; points[3][1] = y1;
  85.     _GrBuildCustomLineData(o,&args);
  86.     _GrSetupSolidDraw(&o->lno_color,&args);
  87.     _GrDrawPolygon(4,points,
  88.         TRUE,
  89.         TRUE,
  90.         _GrDoCustomCorner,
  91.         _GrDoCustomSegment,
  92.         &args
  93.     );
  94. }
  95.  
  96.